/*
********************************************************************************
* Copyright (C) 2021, xiang.D <dx_65535@163.com>.
* All right reserved.
*
* File Name   : led.cc
* Author      :
* Version     : V1.0
* Description :
* Journal     : 2021-11-27 init v1.0
* Brief       : Blog: https://blog.csdn.net/qq_38750572?spm=1001.2014.3001.5343
* Others      :
********************************************************************************
*/

#include <stdio.h>
#include "led.h"
#include "cmd_type.h"

#define LED_LOGI(fmt, args...) printf("Led: I: %d " fmt, __LINE__, ##args)
#define LED_LOGD(fmt, args...) printf("Led: D: %d " fmt, __LINE__, ##args)
#define LED_LOGW(fmt, args...) printf("Led: W: %d " fmt, __LINE__, ##args)
#define LED_LOGE(fmt, args...) printf("Led: E: %d " fmt, __LINE__, ##args)

CLed* CLed::GetInstance()
{
    static CLed mObj;
    return &mObj;
}

int CLed::ProcessMsg(long long cmdValue)
{
    LED_LOGI("Get cmd: 0x%llx\n", cmdValue);

    switch (cmdValue)
    {
        case CMD_LED_ON:
            LedOn();
        break;

        case CMD_LED_OFF:
            LedOff();
        break;

        case CMD_LED_HORSE:
            LedHorse();
        break;

        default:
            LED_LOGW("No process 0x%llx\n", cmdValue);
        break;
    }

    return 0;
}

void CLed::LedOn()
{
    LED_LOGI("--- led on ---\n");
}

void CLed::LedOff()
{
    LED_LOGI("--- led off ---\n");
}

void CLed::LedHorse()
{
    LED_LOGI("--- horse led ---\n");
}